﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XProject.DataVisit.Factory;

namespace XProject.DataVisit.Model.Temp
{
    public class FlowTemp
    {
        public  Guid PID { get; set; }
        /// <summary>
        /// 广告名称
        /// </summary>
        public  string GName { get; set; }
        /// <summary>
        /// 广告URL
        /// </summary>
        public  string GUrl { get; set; }
        /// <summary>
        /// 广告备注
        /// </summary>
        public  string GRemark { get; set; }
        /// <summary>
        /// 发布者
        /// </summary>
        public  Guid Creater { get; set; }
        /// <summary>
        /// 有效期
        /// </summary>
        public  int Period { get; set; }
        /// <summary>
        /// 广告来源1表示上传，2表示定制
        /// </summary>
        public  string GType { get; set; }
        /// <summary>
        /// 文件夹名称
        /// </summary>
        public  string FolderName { get; set; }
        /// <summary>
        /// 流程标志0表示未完成，1表示完成,2表示还在流程中
        /// </summary>
        public  int TransfState { get; set; }

        public  string TransfS
        {
            get
            {
                switch (TransfState)
                {
                    case 0: return "未进入流程";
                    case 1: return "通过审核";
                    case 2: return "未审核完";
                    default: return "未进入流程";
                }
            }
        }

        /// <summary>
        /// 所属流程
        /// </summary>
        public  Guid? BelongFlow { get; set; }
        /// <summary>
        /// 剩余日期
        /// </summary>
        public  string SurplusTime
        {
            get
            {
                if (DateTime.Compare(Lastupdate.AddDays(Convert.ToDouble(Period)), DateTime.Now) < 0)
                    return "已经失效";
                return (Lastupdate.AddDays(Convert.ToDouble(Period)) - DateTime.Now).Days.ToString();
            }
        }

        public  DateTime Lastupdate { get; set; }


        public  string NTime
        {
            get
            {
                return Lastupdate.ToString("yyyy-MM-dd");
            }
        }

        public  string GT
        {
            get
            {
                return GType != "1" ? "定制广告" : "上传广告";
            }
        }

        public  UserInfo ChargeUser
        {
            get
            {
                if (Creater != Guid.Empty)
                    return DaoFactory.UserInfoDao.GetById(Creater);
                return null;
            }
        }


        public virtual Guid FlowPID { get; set; }
        /// <summary>
        /// 流程ID
        /// </summary>
        public virtual Guid FlowID { get; set; }
        /// <summary>
        /// 人员ID
        /// </summary>
        public virtual Guid PersonID { get; set; }
        /// <summary>
        /// 节点ID
        /// </summary>
        public virtual Guid NodeID { get; set; }
        /// <summary>
        /// 外键ID
        /// </summary>
        public virtual string ContentID { get; set; }

        public virtual DateTime FlowLastUpdate { get; set; }
    }
}
